<template>
  <div>
  <van-tabs>
    <van-tab title="微信">
      <van-form @submit="getUserCash">
        <van-field
          v-model='userInfo.money'
          name="money"
          :placeholder=" '最低提现金额为' + bankInfo.minPrice"
          label="提现金额"
          :rules="[{ required: true, message: '请填写提现金额' }]"
        />
        <van-field
          v-model='userInfo.weixin'
          name="weixin"
          label="提现账号"
          placeholder="输入微信绑定的手机"
          :rules="[{ required: true, message: '填写微信' }]"
        />
        <div class='money'>现有余额 : {{bankInfo.commissionCount}}(请填写正确信息，有误概不退款)</div>
        <div style="margin: 16px;">
          <van-button round block type="info" native-type="submit">提交</van-button>
        </div>
      </van-form>
    </van-tab>

    <van-tab title="支付宝">
      <van-form @submit="getUserCash">
        <van-field
          v-model='userInfo.money'
          name="money"
          :placeholder=" '最低提现金额为' + bankInfo.minPrice"
          label="提现金额"
          :rules="[{ required: true, message: '请填写提现金额' }]"
        />
        <van-field
          v-model='userInfo.alipayCode'
          name="alipayCode"
          label="提现账号"
          placeholder="输入支付宝绑定的手机"
          :rules="[{ required: true, message: '填写支付宝' }]"
        />
        <van-field
          v-model='userInfo.name'
          name="name"
          label="支付宝用户名"
          placeholder="输入支付宝的用户名"
          :rules="[{ required: true, message: '用户名' }]"
        />
        <div class='money'>现有余额 : {{bankInfo.commissionCount}} (请填写正确信息，有误概不退款)</div>
        <div style="margin: 16px;">
          <van-button round block type="info" native-type="submit">提交</van-button>
        </div>
      </van-form>
    </van-tab>
  </van-tabs>

  </div>
</template>

<script>
import {userBank,userCash} from "@/api/extarck"
export default {
  name: 'Extrack',
  data(){
    return{
      bankInfo:{

      },
      userInfo: {
        weixin:'',
        alipayCode:'',
        money:'',
        name:'',
        extractType: "1",
      },
      subData:''
    }
  },
  methods:{
    getUserBank(){
      userBank().then(res =>{
        this.bankInfo = res.data
        this.subData = JSON.stringify(this.userInfo)
      })
    },
    getUserCash(){
      this.subData = JSON.stringify(this.userInfo)
      userCash(this.subData).then(res =>{
      })
    }
  },
  created() {
      this.getUserBank()
  }
}
</script>

<style scoped>
.money{
  color: #999;
  font-size: 15px;
  margin-left: 4%;
}
</style>
